#include <iostream>
#include <string>
#include <cctype>

using namespace std;

int main()
{
	string s;

	while (getline(cin, s))
	{
		int result = 0;
		s = " " + s;
		for (int i = 0; i < s.size()-1; i++)
			if (!isalpha(s[i]) && (isalpha(s[i+1]))) result++;
		cout << result << endl;
	}

	return 0;
}
